<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        /* 定义计数器 */
        .counter {
            counter-reset: mycounter;
        }

        /* 每次增加计数器 */
        .p::before {
            content: "编号" counter(mycounter) ":";
            counter-increment: mycounter;
        }
    </style>
    </style>
</head>
<body>
    <div class="counter">
        <p class="p">这是第一段文字</p>
        <p class="p">这是第二段文字</p>
        <p class="p">这是第三段文字</p>
    </div>
</body>
</html>